#!/usr/bin/perl -w
#
# CHECK LIST FILE
#
#
# SYNTAX (disregard the two leading characters -# - in each line of the following example) 
#-------------------------------------------- 
# ## namecheck start  ######
# {$params={
#   name      => "namecheck", 
#   type      => n, 
#   some_text => "some string", 
#   some_int  => m, 
#   some_real => xx.xxxEp
#   some_list => [n1,n2,n3,r1,r2,s1,s2,s3]};
# }
# ## namecheck end  ######
# --------------------------------------------
# Comments:
#
# 1) the syntax of the first and last comment line IS important 
#    since the program will fetch the hash between those two lines
#    based on a corresponding sting search
# 2) "namecheck" has to be the same as the one used in the CHECKLIST
#    of the .tst file and in the element "name" of the hash referenced 
#    by $params
# 3) "type" defines the kind of test to be performed, and the other 
#    necessary parameters depend on it (some_text, some_int and some_real are given for conveneience)
# 4) one or more list-type parameter can be specified if needed
# 5) the input parsing of the .tst file allows to chance the values of the parameters
#
#########################################################################################
#
# test type 0
# search for a number in a selected line and compare it with its reference counterpart
# arguments. 
# The line is split and the elemnts are stored into four arrays:
# strings, integers, floats, numbers(both integers and floats). 
# The order of the arguments is preserved within each array
#
# string: string to search
# pos: number position in the selected array (integers, floats, numbers, strings)
# abs: 0/1 0: check with sign 1: check absolute value
# rel: 0/1 when active the relative error is used instead of the absolute error
# thr: accuracy of the test
# num_type: array of line elements to be used -1 (numbers) 0 (strings) 1 (integers) 2 (floats)
#

# WARNING: DO NOT change the following test. It provides default values for all tests of type 0
## default_0 start ###############################
{$params={
  name    => "default_0", 
  type    => 0, 
  string  => "abcdefghijklmnopqrstuvwxyz", 
  pos     => 999, 
  abs     => 0,
  rel     => 0,
  thr     => 1.0e-10,
  zerothr => 1.0e-16,
  num_type => -1};
}
## default_0 end  #################################

## enedft start ###############################
{$params={
  name   => "enedft", 
  type   => 0, 
  string => "Final DFT", 
  pos    => 1, 
  thr    => 1.0e-10};
}
## enedft end  #################################

## enehf start ################################
{$params={
  name   => "enehf",
  type   => 0,
  string => "Final HF",
  pos    => 1,
  thr    => 1.0e-10};
}
## enehf end  #################################

## enemc start ################################
{$params={
  name   => "enemc",
  type   => 0,
  string => "Final MCSCF",
  pos    => 1,
  thr    => 1.0e-10};
}
## enemc end  #################################

## tes start ################################################
{$params={
  name   => "tes",
  type   => 0,
  string => "TOTAL NUMBER OF TESSERAE",
  pos    => 1,
  thr    => 0.1};
}
## tes end  #################################################

## nuc start #####################################################
{$params={
  name   => "nuc",
  type   => 0,
  string => "Nuclear repulsion energy",
  pos    => 1,
  thr    => 1.0e-10};
}
## nuc end  ######################################################

## surf start #####################################################
{$params={
  name   => "surf",
  type   => 0,
  string => "Surface area",
  pos    => 1,
  thr    => 1.0e-7};
}
## surf end  #####################################################

## nucchg start #########################################################
{$params={
  name   => "nucchg",
  type   => 0,
  string => "Nuclear apparent charge",
  pos    => 1,
  thr    => 1.0e-4};
}
## nucchg end  #########################################################

## elactive start #######################################################
{$params={
  name   => "elactive",
  type   => 0,
  string => "Number of electrons in active shells",
  pos    => 1,
  thr    => 1.0e-5};
}
## elactive end  #######################################################


#
# test type 1
# fetch all/some lines containing a predefined string
# for each line performs the same test as test type 0
# arguments of the list
# string:   string to search
# maxout:   maximum lines of output to parse in file (all if negative)
# maxget: maximum number of matching lines to fetch (all if negative)
# pos:      number position in the line (spaces stripped out)
# abs:      0/1 0: check with sign 1: check absolute value
# rel:      0/1 when active the relative error is used instead of the absolute error
# thr:      accuracy of the test
#

# WARNING: DO NOT change the following test. It provides default values for all tests of type 1
## default_1 start ###############################
{$params={
  name     => "default_1", 
  type     => 1, 
  string   => "abcdefghijklmnopqrstuvwxyz", 
  maxout   => -1,
  maxget   => -1,
  pos      => 999, 
  abs      => 0,
  rel      => 0,
  thr      => 1.0e-10,
  zerothr  => 1.0e-16};
}
## default_1 end  #################################

## beta start #######################################################
{$params ={
  name     => "beta",
  type     => 1,
  string   => "B-freq =",
  maxout   => -1,
  maxget   => -1,
  pos      => 10,
  thr      => 1.0e-4};
}
## beta end  #####################################################

## HFenergies start #######################################################
{$params ={
  name     => "HFenergies",
  type     => 1,
  string   => "Final HF",
  maxout   => -1,
  maxget   => -1,
  pos      => 4,
  thr      => 1.0e-10};
}
## HFenergies end  #####################################################

## diplen start #######################################################
{$params ={
  name     => "diplen",
  type     => 1,
  string   => "DIPLEN  ;",
  maxout   => -1,
  maxget   => -1,
  pos      => 8,
  thr      => 1.0e-6};
}
## diplen end  #####################################################

## diploc start #######################################################
{$params ={
  name     => "diploc",
  type     => 1,
  string   => "DIPLOC  ;",
  maxout   => -1,
  maxget   => -1,
  pos      => 8,
  thr      => 1.0e-6};
}
## diploc end  #####################################################

## qrlrve start #######################################################
{$params ={
  name     => "qrlrve",
  type     => 1,
  string   => "QRLRVE: SINGLET",
  maxout   => -1,
  maxget   => -1,
  pos      => 7,
  thr      => 1.0e-6};
}
## qrlrve end  #####################################################

## qrlrve2 start #######################################################
{$params ={
  name     => "qrlrve2",
  type     => 1,
  string   => "QRLRVE:  ",
  maxout   => -1,
  maxget   => -1,
  pos      => 9,
  thr      => 1.0e-8};
}
## qrlrve2 end  #####################################################

## Bterm start #######################################################
{$params ={
  name     => "Bterm",
  type     => 1,
  string   => "B term",
  maxout   => -1,
  maxget   => -1,
  pos      => 4,
  thr      => 1.0e-8};
}
## Bterm end  #####################################################

## or_lon start #######################################################
{$params ={
  name     => "or_lon",
  type     => 1,
  string   => "Optical rotation \\(L",
  maxout   => -1,
  maxget   => -1,
  pos      => 5,
  thr      => 1.0e-4};
}
## or_lon end  #####################################################

## shield start #######################################################
{$params ={
  name     => "shield",
  type     => 1,
  string   => "Shielding constant:",
  maxout   => -1,
  maxget   => -1,
  pos      => 3,
  thr      => 1.0e-4};
}
## shield end  #####################################################

## Icoupl start #######################################################
{$params ={
  name     => "Icoupl",
  type     => 1,
  string   => "Isotropic coupling  ",
  maxout   => -1,
  maxget   => -1,
  pos      => 4,
  thr      => 1.0e-4};
}
## Icoupl end  #####################################################

## Acoupl start #######################################################
{$params ={
  name     => "Acoupl",
  type     => 1,
  string   => "Anisotropic coupling  ",
  maxout   => -1,
  maxget   => -1,
  pos      => 4,
  thr      => 1.0e-4};
}
## Acoupl end  #####################################################

## zfs start #######################################################
{$params ={
  name     => "zfs",
  type     => 1,
  string   => "ZFS parameter",
  maxout   => -1,
  maxget   => -1,
  pos      => 5,
  thr      => 1.0e-4};
}
## zfs end  #####################################################

#
# test type 2
# fetch a block of lines between two user-defined strings, then perform a test
# type 0 on a selected line
# arguments
# start_string: String defining the starting line
# end_string:   String defining the final line
# start_offset: n. of lines stripped away at the beginning of the block
# end_offset:   n. of lines stripped away at the end of the block (if negative add the coresponding number of lines after the matching end string)
# line:         line on which test type 0 is performed
# pos:          number position in the line
# thr:          accuracy of the test
# abs: 0/1      0: check with sign 1: check absolute value
# rel: 0/1      when active the relative error is used instead of the absolute error
#

# WARNING: DO NOT change the following test. It provides default values for all tests of type 2
## default_2 start ###############################
{$params={
  name         => "default_2", 
  type         => 2, 
  start_string => "abcdefghijklmnopqrstuvwxyz", 
  end_string   => "zyxwvutsrqponmlkjihgfedcba",
  start_offset => 0,
  end_offset   => 0,
  line         => 999,
  pos          => 999, 
  abs          => 0,
  rel          => 0,
  thr          => 1.0e-10};
}
## default_2 end  #################################

## coord_2 start ###############################
{$params={
  name         => "coord_2", 
  type         => 2, 
  start_string => "Total number of coordinates", 
  end_string   => "Interatomic separations",
  start_offset => 1,
  end_offset   => 3,
  line         => 999,
  pos          => 999, 
  abs          => 0,
  rel          => 0,
  thr          => 1.0e-10};
}
## default_2 end  #################################

## dipole start #######################################################
{$params={
  name         => "dipole",
  type         => 2,
  start_string => "Dipole moment",
  end_string   => "Dipole moment components",
  start_offset => 0,
  end_offset   => 0,
  line         => 5,
  pos          => 1,
  thr          => 1.0e-6};
}
## dipole end  #######################################################

## dipolelf start #######################################################
{$params ={
  name         => "dipolelf",
  type         => 2,
  start_string => "Local-field corrected dipole moment",
  end_string   => "Local-field corrected dipole moment components",
  start_offset => 0,
  end_offset   => 0,
  line         => 5,
  pos          => 1,
  thr          => 1.0e-6};
}
## dipolelf end  #######################################################
#
#
# test type 3
# fetch lines as in test type 1 then compare several numbers on each line
# arguments
# string: string to search
# maxout: maximum lines of output to parse in file (all if negative)
# maxget: maximum number of matching lines to fetch (all if negative)
# pos:    list of n positions 
# thr:    list of m1 thresholds
# abs: list of 0/1  0: check with sign 1: check absolute value
# rel: list of 0/1: when active the relative error is used instead of the absolute error
#
# if m = n the i-th position will take the i-th threshold
# if m > n thresholds/abs beyond n are ignored
# if m < n the last threshold/abs value is replicated until n

# WARNING: DO NOT change the following test. It provides default values for all tests of type 3
## default_3 start ###############################
{$params={
  name     => "default_3",
  type     => 3, 
  string   => "abcdefghijklmnopqrstuvwxyz", 
  maxout   => -1,
  maxget   => -1,
  num_type => -1,
  pos      => [998, 999],
  abs      => [0, 0],
  rel      => [0, 0],
  thr      => [1.0e-10, 1.0e-10]};
}
## default_3 end  #################################

## tramom start #######################################################
{$params ={
  name   => "tramom",
  type   => 3,
  string => " STATE NO: ",
  maxout => -1,
  maxget => -1,
  abs    => [ 1, 0 ],
  rel    => [ 0, 0 ],
  pos    => [ 2, 3 ],
  thr    => [ 1.0e-6, 1.0e-5 ] };
}
## tramom end  #######################################################

## omegab start #######################################################
{$params ={
  name   => "omegab",
  type   => 3,
  string => "omega B",
  maxout => -1,
  maxget => -1,
  abs    => [ 0, 0, 1 ],
  pos    => [ 1, 2, 3 ],
  thr    => [ 1.0e-5 ]};
}
## omegab end  #######################################################

## cmass start #######################################################
{$params ={
  name   => "cmass",
  type   => 3,
  string => "Center-of-mass",
  maxout => -1,
  maxget => -1,
  pos    => [ 1, 2, 3 ],
  thr    => [1.0e-5]};
}
## cmass end  #######################################################

## gauge_or start #######################################################
{$params ={
  name   => "gauge_or",
  type   => 3,
  string => "Center of mass gauge origin",
  maxout => -1,
  maxget => -1,
  pos    => [ 1, 2, 3 ],
  thr    => [ 1.0e-5 ] };
}
## gauge_or end  #########################################################

#
# test type 4
# fetch a line and compare it with the reference output
# arguments
# string: string to search
# maxout: maximum lines of output to parse in file (all if negative)
# post: post processing of fetched line: 
#       allowed post values: 0 no post processing
#                            1 strip initial spaces
#                            2 strip all spaces
#                            3 remove n char from the beginning before comparing
#                            4 remove m char from the end before comparing
#                            5 remove n char from the beginning and m char from the end before comparing
# rembeg: n (see post=3/5)
# remend: m (see post=4/5)
#

# WARNING: DO NOT change the following test. It provides default values for all tests of type 4
## default_4 start ###############################
{$params={
  name   => "default_4", 
  type   => 4, 
  string => "abcdefghijklmnopqrstuvwxyz", 
  maxout => -1,
  post   => 0, 
  rembeg => 0,
  remend => 0};
}
## default_4 end  #################################

## pcmsol start #######################################################
{$params = {
  name   => "pcmsol",
  type   => 4,
  string => "LOOKING UP INTERNALLY STORED DATA FOR SOLVENT",
  maxout => -1,
  post   => 2,
  rembeg => 0,
  remend => 0};
}
## pcmsol end  #######################################################

## sym start #######################################################
{$params = {
  name   => "sym",
  type   => 4,
  string => "Point group",
  maxout => -1,
  post   => 2,
  rembeg => 0,
  remend => 0};
}
## sym end  #######################################################

## addlf start #######################################################
{$params = {
  name   => "addlf",
  type   => 4,
  string => "ADDING LOCAL",
  maxout => -1,
  post   => 2,
  rembeg => 0,
  remend => 0};
}
## addlf end  #######################################################

## symop start #######################################################
{$params = {
  name   => "symop",
  type   => 4,
  string => "Spin symmetry of",
  maxout => -1,
  post   => 2,
  rembeg => 0,
  remend => 0};
}
## symop end  #######################################################

## neqrsp start #######################################################
{$params = {
  name   => "neqrsp",
  type   => 4,
  string => "NEQRSP =T",
  maxout => -1,
  post   => 2,
  rembeg => 0,
  remend => 0};
}
## neqrsp end  #######################################################

#
# test type 5 (this test type is discontinued!)
# fetch a block of lines (as in test type 2) then
# performs a specific check
# arguments:
# start_string: String defining the starting line
# end_string:   String defining the final line
# star_offset:  n. of lines stripped away at the beginning of the block
# end_offset:   n. of lines stripped away at the end of the block (if negative add the coresponding number of linse after the matching end string)
# post:         post processing type
#               allowed values: 0 coordinates check
#

# WARNING: DO NOT change the following test. It provides default values for all tests of type 5
## default_5 start ###############################
{$params={
  name         => "default_5", 
  type         => 5, 
  start_string => "abcdefghijklmnopqrstuvwxyz", 
  end_string   => "zyxwvutsrqponmlkjihgfedcba",
  start_offset => 0,
  end_offset   => 0,
  post         => 0};
}
## default_5 end  #################################

#
# test type 6
# fetch a block of lines (as in test type 2) then
# performs a check on one or more numbers in each line (as in check type 2)
# arguments:
# start_string: String defining the starting line
# end_string:   String defining the final line
# star_offset:  n. of lines stripped away at the beginning of the block
# end_offset:   n. of lines stripped away at the end of the block (if negative add the coresponding number of linse after the matching end string)
# pos:          list of positions of the values to extract on each line
# thr:          list of threshold for the numerical comparisons
# abs:          list of absolute value flags
# rel:          list of 0/1: when active the relative error is used instead of the absolute error
#

# WARNING: DO NOT change the following test. It provides default values for all tests of type 6
## default_6 start ###############################
{$params={
  name         => "default_6", 
  type         => 6, 
  start_string => "abcdefghijklmnopqrstuvwxyz", 
  end_string   => "zyxwvutsrqponmlkjihgfedcba",
  start_offset => 0,
  end_offset   => 0,
  pos          => [998,     999],
  thr          => [1.0e-10, 1.0e-10],
  abs          => [0,       0]};
  rel          => [0,       0]};
}
## default_6 end  #################################

#
# test type 7
# fetch lines as in test type 1 then compare all found numbers on each line
# arguments
# string:   string to search
# maxout:   maximum lines of output to parse in file (all if negative)
# maxget:   maximum number of matching lines to fetch (all if negative)
# startn:   first number to check on the line
# endn  :   last number to check on the line
# howtospl: how to split each matching line
#           - 0: split employing spaces
# thr:      list of thresholds
# abs:      list of 0/1 0: check with sign 1: check absolute value
# rel:      list of 0/1 when active the relative error is used instead of the absolute error
#
# abs and thr are repolicated/ignored as in check n.3

# WARNING: DO NOT change the following test. It provides default values for all tests of type 7
## default_7 start ###############################
{$params={
  name     => "default_7", 
  type     => 7, 
  string   => "abcdefghijklmnopqrstuvwxyz", 
  maxout   => -1,
  maxget   => -1,
  startn   => 1,
  endn     => 1,
  howtospl => 0,
  abs      => [0, 0],
  rel      => [0, 0],
  thr      => [1.0e-10, 1.0e-10]};
}
## default_7 end  #################################

## Frequencies start ###############################
{$params={
  name     => "Frequencies", 
  type     => 7, 
  string   => "Frequencies          ", 
  maxout   => -1,
  maxget   => 2,
  startn   => 3,
  endn     => 2,
  howtospl => 0,
  abs      => [0],
  rel      => [0],
  thr      => [1.0e-6]};
=======
  pos          => [7,10,13],
  thr          => [1e-10],
  abs          => [0]};
}
## coordi_sym end  #######################################################

## coordi_nosym start #######################################################
{$params = {
  name         => "coordi_nosym",
  type         => 6,
  start_string => "Total number of coordinates:",
  end_string   => "Interatomic separations",
  start_offset => 1,
  end_offset   => 3,
  pos          => [5,8,11],
  thr          => [1e-10],
  abs          => [0]};
}
## coordi_nosym end  #######################################################

#
# test type 7
# fetch lines as in test type 1 then compare all found numbers on each line
# arguments
# string:   string to search
# maxout:   maximum lines of output to parse in file (all if negative)
# maxget:   maximum number of matching lines to fetch (all if negative)
# startn:   first number to check on the line
# endn  :   last number to check on the line
# howtospl: how to split each matching line
#           - 0: split employing spaces
# thr:      list of thresholds
# abs:      list of 0/1 0: check with sign 1: check absolute value
# rel:      list of 0/1 when active the relative error is used instead of the absolute error
#
# abs and thr are repolicated/ignored as in check n.3

# WARNING: DO NOT change the following test. It provides default values for all tests of type 7
## default_7 start ###############################
{$params={
  name     => "default_7", 
  type     => 7, 
  string   => "abcdefghijklmnopqrstuvwxyz", 
  maxout   => -1,
  maxget   => -1,
  startn   => 1,
  endn     => 1,
  howtospl => 0,
  abs      => [0, 0],
  rel      => [0, 0],
  thr      => [1.0e-10, 1.0e-10]};
}
## default_7 end  #################################

## Frequencies start ###############################
{$params={
  name     => "Frequencies", 
  type     => 7, 
  string   => "Frequencies          ", 
  maxout   => -1,
  maxget   => 2,
  startn   => 3,
  endn     => 2,
  howtospl => 0,
  abs      => [0],
  rel      => [0],
  thr      => [1.0e-6]};
>>>>>>> 1.5
}
## Frequencies end  #################################

